﻿using System;

namespace Mg.Components
{
    /// <summary>
    /// Mg框架自动管理生命对象特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class ComponentAttribute: Attribute
    {
        public LifeStyle LifeStyle { get; private set; }

        public ComponentAttribute() : this(LifeStyle.Singleton) { }

        public ComponentAttribute(LifeStyle lifeStyle)
        {
            LifeStyle = lifeStyle;
        }
    }

    public enum LifeStyle
    {
        /// <summary>
        /// 局部对象
        /// </summary>
        Transient,
        /// <summary>
        /// 全局唯一对象
        /// </summary>
        Singleton
    }

}
